﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace GameName1
{
    abstract class PowerUp : GameObject, IHittable, IDisplayable, IMovable
    {
        private float _alpha = 1.0f;
        protected PowerUp(Vector2 position) : base(position)
        {
            
        }

        public override void Update(GameTime gameTime)
        {
            if (Position.Y > ScreenManager.GetInstance().Resolution.Y - 100) _alpha -= 0.06f;
            Velocity = new Vector2(0, 2);
            Move();
        }

        protected abstract Texture2D Sprite { get; }
        public int DrawingOrder { get { return 1; } }
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Sprite,Position,new Color(Color.White,_alpha));
        }

        public abstract void HandleHit(IHittable other, GameTime colissionTime);
        public Rectangle GetCollisionBox()
        {
            return new Rectangle((int)Position.X, (int)Position.Y, Sprite.Width, Sprite.Height);
        }
        public IEnumerable<Type> GetNotHittableTypes()
        {
            return new List<Type> { typeof(AngryAlien), typeof(BonusAlien), typeof(Missile) };
        }

        public Vector2 Velocity { get; set; }
        public void Move()
        {
            Position += Velocity;
        }
    }
}
